package com.team.sion.mapper;

import com.team.sion.pojo.Collect;
import com.team.sion.pojo.CollectExample;
import java.util.List;
import org.apache.ibatis.annotations.Delete;
import org.apache.ibatis.annotations.Insert;
import org.apache.ibatis.annotations.Param;
import org.apache.ibatis.annotations.ResultMap;
import org.apache.ibatis.annotations.Select;
import org.apache.ibatis.annotations.Update;

public interface CollectMapper {
    long countByExample(CollectExample example);

    int deleteByExample(CollectExample example);

    @Delete({
        "delete from collect",
        "where id = #{id,jdbcType=INTEGER}"
    })
    int deleteByPrimaryKey(Integer id);

    @Insert({
        "insert into collect (id, user_id, ",
        "type, song_id, songList_id, ",
        "createTime)",
        "values (#{id,jdbcType=INTEGER}, #{userId,jdbcType=INTEGER}, ",
        "#{type,jdbcType=VARCHAR}, #{songId,jdbcType=INTEGER}, #{songlistId,jdbcType=INTEGER}, ",
        "#{createtime,jdbcType=DATE})"
    })
    int insert(Collect row);

    int insertSelective(Collect row);

    List<Collect> selectByExample(CollectExample example);

    @Select({
        "select",
        "id, user_id, type, song_id, songList_id, createTime",
        "from collect",
        "where id = #{id,jdbcType=INTEGER}"
    })
    @ResultMap("com.team.sion.mapper.CollectMapper.BaseResultMap")
    Collect selectByPrimaryKey(Integer id);

    int updateByExampleSelective(@Param("row") Collect row, @Param("example") CollectExample example);

    int updateByExample(@Param("row") Collect row, @Param("example") CollectExample example);

    int updateByPrimaryKeySelective(Collect row);

    @Update({
        "update collect",
        "set user_id = #{userId,jdbcType=INTEGER},",
          "type = #{type,jdbcType=VARCHAR},",
          "song_id = #{songId,jdbcType=INTEGER},",
          "songList_id = #{songlistId,jdbcType=INTEGER},",
          "createTime = #{createtime,jdbcType=DATE}",
        "where id = #{id,jdbcType=INTEGER}"
    })
    int updateByPrimaryKey(Collect row);
}